package com.santiao.youxiang.ui.widget

import android.app.Dialog
import android.content.Context
import android.view.Window
import android.widget.TextView
import android.widget.Toast
import com.hjq.permissions.Permission
import com.hjq.permissions.XXPermissions
import com.santiao.youxiang.R

class PermissionDialog(myContext: Context) : Dialog(myContext) {
    init {
        requestWindowFeature(Window.FEATURE_NO_TITLE)
        setContentView(R.layout.request_permission_dialog)
        setCancelable(false)
        val set=findViewById<TextView>(R.id.pop_permission_set)
        set.setOnClickListener{
            dismiss()
            XXPermissions.startPermissionActivity(myContext, Permission.ACCESS_FINE_LOCATION)
        }
        val cancel=findViewById<TextView>(R.id.pop_permission_cancel)
        cancel.setOnClickListener{
            dismiss()
            Toast.makeText(myContext,"未开启权限，相关功能暂时无法使用",Toast.LENGTH_SHORT).show()
        }
    }
}